package com.qf.userinformationsystem.config;

import com.qf.userinformationsystem.filter.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //配置那些需要拦截，那些不需要
                .addPathPatterns("/**")
                .excludePathPatterns("/index.html","/register.html","/show.html","/userInfo/showAccount","/userInfo/getAll","/js/**","/user/login","/user/register","/userInfo/searchByFour");
    }
}
